package com.example.doc;

import org.springframework.data.elasticsearch.annotations.*;


import java.io.Serializable;

/**
 *设置索引名、类型
 * 设置字段的 mapping 以及 所采用的分词器 注：实体采用的ik 分词。
 *   1.如需其他分词器需修改字段上的：analyzer、searchAnalyzer
 *   2.在安装的elasticsearch 导入其他分词 
 *   3.如使用原始分词器，可将字段上注解去掉
 */
@Document(indexName = "test-goods",type = "goods")
public class GoodsInfo  implements Serializable {
    private Long id;
    @Field(analyzer = "ik_max_word",searchAnalyzer = "ik_max_word",store = true,index = true,type = FieldType.text )
    private String name;
    @Field(analyzer = "ik_max_word",searchAnalyzer = "ik_max_word",store = true ,index = true,type = FieldType.text)
    private String description;

    public GoodsInfo() {
    }

    public Long getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public String getDescription() {
        return this.description;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setDescription(String description) {
        this.description = description;
    }
    public GoodsInfo(Long id, String name, String description) {
        this.id = id;
        this.name = name;
        this.description = description;
    }



    public String toString() {
        return "GoodsInfo(id=" + this.getId() + ", name=" + this.getName() + ", description=" + this.getDescription() + ")";
    }
}
